@extends('layouts.layouts')
@section('content')
    <!--面包屑导航 开始-->
    <div class="crumb_warp">
        <!--<i class="fa fa-bell"></i> 欢迎使用登陆网站后台，建站的首选工具。-->
        <i class="fa fa-home"></i> <a href="{{ url('Admin/info') }}">首页</a> &raquo;修改文章
    </div>
    <!--面包屑导航 结束-->

	<!--结果集标题与导航组件 开始-->
	<div class="result_wrap">
        <div class="result_title">
            <h3>修改文章</h3>
            @if(count($errors)>0)
                <div class="mark">
                    @foreach($errors->all() as $error)
                        <p>{{ $error }}</p>
                    @endforeach
                </div>
            @endif
            @if(session('info'))
                <div class="mark">
                    <p>{{ session('info') }}</p>
                </div>
            @endif
        </div>
        <div class="result_content">
            <div class="short_wrap">
                <a href="{{ url('Admin/article/create') }}"><i class="fa fa-plus"></i>添加文章</a>
                <a href="{{ url('Admin/article') }}"><i class="fa fa-recycle"></i>文章列表</a>
            </div>
        </div>
    </div>
    <!--结果集标题与导航组件 结束-->
    
    <div class="result_wrap">
        <form action="{{ url('Admin/article/'.$data->art_id) }}" method="post">
            {{ csrf_field() }}
            <input type="hidden" name="_method" value="put">
            <table class="add_tab">
                <tbody>
                <tr>
                    <th width="120">分类：</th>
                    <td>
                        <select name="art_cate">
                            @foreach($cate as $c)
                                <option value="{{ $c -> cate_id }}"
                                @if($c->cate_id == $data->art_cate)
                                selected
                                @endif
                                >{{ $c-> cate_name }}</option>
                            @endforeach
                        </select>
                    </td>
                </tr>
                <tr>
                    <th><i class="require">*</i>文章标题：</th>
                    <td>
                        <input type="text" class="lg" name="art_title" value="{{ $data->art_title }}">
                    </td>
                </tr>
                <tr>
                    <th><i class="require">*</i>文章作者：</th>
                    <td>
                        <input type="text" name="art_editor" class="sm" value="{{ $data->art_editor }}">
                    </td>
                </tr>
                <tr>
                    <th>缩略图：</th>
                    <td>
                        <input type="text" size="50" name="art_img" value="{{ $data->art_img }}">
                        <script src="{{ asset('/uploadify/jquery.uploadify.min.js') }}" type="text/javascript"></script>
                        <link rel="stylesheet" type="text/css" href="{{ asset('/uploadify/uploadify.css') }}">
                        <input id="file_upload" name="file_upload" type="file" multiple="true">
                        <script type="text/javascript">
                            <?php $timestamp = time();?>
                            $(function() {
                                $('#file_upload').uploadify({
                                    'formData'     : {
                                        'timestamp' : '<?php echo $timestamp;?>',
                                        '_token'     : '{{ csrf_token() }}'
                                    },
                                    'swf'      : "{{ asset('/uploadify/uploadify.swf') }}",
                                    'uploader' : "{{ url('/Admin/article/upload') }}",
                                    'buttonText' :'图片上传',
                                    'onUploadSuccess' : function(file, data, response)
                                    {
                                        $('input[name = art_img]').val(data);
                                        $('#art_img').attr('src',data);
                                    }
                                });
                            });
                        </script>
                        <style>
                            .uploadify{display:inline-block;}
                            .uploadify-button{border:none; border-radius:5px; margin-top:8px;}
                            table.add_tab tr td span.uploadify-button-text{color: #FFF; margin:0;}
                        </style>
                    </td>
                </tr>
                <tr>
                    <th></th>
                    <td>
                        <img src="{{ url(''.$data->art_img.'') }}" width='200' style='margin:10px' id="art_img">
                    </td>
                </tr>
                <tr>
                    <th>关键词：</th>
                    <td>
                        <input type="text" class="lg" name="art_tag" value="{{ $data->art_tag }}">
                    </td>
                </tr>
                <tr>
                    <th>文章描述：</th>
                    <td>
                        <textarea name="art_discription">{{ $data->art_discription }}</textarea>
                    </td>
                </tr>
                <tr>
                    <th>文章内容：</th>
                    <td>
                        <script type="text/javascript" charset="utf-8" src="{{ asset('/ueditor/ueditor.config.js') }}"></script>
                        <script type="text/javascript" charset="utf-8" src="{{ asset('/ueditor/ueditor.all.min.js') }}"> </script>
                        <!--建议手动加在语言，避免在ie下有时因为加载语言失败导致编辑器加载失败-->
                        <!--这里加载的语言文件会覆盖你在配置项目里添加的语言类型，比如你在配置项目里配置的是英文，这里加载的中文，那最后就是中文-->
                        <script type="text/javascript" charset="utf-8" src="{{ asset('/ueditor/lang/zh-cn/zh-cn.js') }}"></script>
                        <script id="editor" name="art_content" type="text/plain" style="width:860px;height:300px;">
                            {!! $data->art_content !!}
                        </script>
                        <script type="text/javascript">
                            var ue = UE.getEditor('editor');
                        </script>
                        <style>
                            .edui-default{line-height: 28px;}
                            div.edui-combox-body,div.edui-button-body,div.edui-splitbutton-body
                            {overflow: hidden; height:20px;}
                            div.edui-box{overflow: hidden; height:22px;}
                        </style>
                    </td>
                </tr>
                <tr>
                    <th></th>
                    <td>
                        <input type="submit" value="提交">
                        <input type="button" class="back" onclick="history.go(-1)" value="返回">
                    </td>
                </tr>
                </tbody>
            </table>
        </form>
    </div>
@endsection